<template>

    <!-- 通过 -->
    <div class="mui-numbox" data-numbox-min='1' style="height: 25px;width: 114px;">
        <button class="mui-btn mui-btn-numbox-minus" type="button" @click.stop="countMinus()">-</button>
        <input id="test" class="mui-input-numbox" type="number" value="1" readonly v-model="countValue" />
        <button class="mui-btn mui-btn-numbox-plus" type="button" @click.stop="countPlus()">+</button>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                goodsid : 0,
                countValue: 1
            }
        },
        methods: {
            countMinus() {
                if (this.countValue > 1) {
                    this.countValue--;
                    this.undateCount();
                }

            },

            countPlus() {
                this.countValue++;
                this.undateCount();
            },
            undateCount() {
                this.$store.commit('undateGoodsInfoCount', {
                    goodsid : this.goodsid,
                    count : this.countValue
                });
            }
        },
        created() {
            this.countValue = this.count;
            this.goodsid = this.id;
        },
        props: ['id', 'count'],
    };
</script>

<style lang="scss" scoped>

</style>